<?php

use Parser\Parser;

require_once('./vendor/autoload.php');

$parser = new Parser();


//单次询价
if (1) {
    $data = file_get_contents('./quote.txt');
    $data = json_decode($data, true);
    $quote = $parser->quote($data);
    var_dump($quote->code);
    var_dump($quote->result);
    var_dump($quote->orderId);
    var_dump($quote->quoteNo);
    //var_dump($quote->result());
    exit;
}
//批量询价
if (0) {
    $data = file_get_contents('./batch.txt');
    $data = json_decode($data, true);
    $code=  $data['code'];
    $data = $data['data'];
    $batch = $data['batch'];

    $item = $data['items'][0];
    $item['batch'] = $batch;
    $item['code'] = $code;
    $item['insureSystemCode'] = $data['insureSystemCode'];

    $quote = $parser->batch($item);

    var_dump($quote->code);
    var_dump($quote->result['status']);
    var_dump($quote->engineNo);
    var_dump($quote->code);
    var_dump($quote->vin);
    var_dump($quote->result());
    exit;
}


//解析
if (0) {
    $data = file_get_contents('./analysis.txt');
    $data = json_decode($data, true);
    $rawData = json_decode($data['data']['items'][0]['rawData'], true);
    $source = $data['data']['insureSystemCode'] ?? $data['data']['insureSource'] ?? 'PICC';

    $analysis = $parser->repetition($rawData, $source);
    var_dump($analysis->getStatus());
    var_dump($analysis->getLastPolicy());
    var_dump($analysis->getLastCompany());
    var_dump($analysis->getLastSignTime());
    var_dump($analysis->getLastEndTime());
    var_dump($analysis->getLastStartAt());
    var_dump($analysis->getLastCoverage());
    var_dump($analysis->getLastCoverage());
    var_dump($analysis);
    exit;
}


exit;



